package com.money.coupon.config;


import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * 开启事务
 */
@Configuration
@EnableTransactionManagement
@MapperScan("com.money.coupon.dao")
public class MybatisPlusConfig {

    /**
     * 这个配置仅仅在mybatisplus3.4以下，3.4及以上要用最新的官网配置
     * @return
     */
    @Bean
    public PaginationInterceptor mybatisPlusInterceptor() {
        PaginationInterceptor plugs = new PaginationInterceptor();

        plugs.setOverflow(true);

        plugs.setLimit(500);
        return plugs;
    }
}
